﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.CMS263.PO;

namespace Com.CMS263.DAO
{
    public class OrderDetailDAO : BaseService
    {
        #region 根据订单Id查询list
        /// <summary>
        /// 根据订单Id查询list
        /// </summary>
        /// <param name="DealInfoId"></param>
        /// <param name="page"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public IList<OrderDetail> GetDealInfoId(int DealInfoId, int page, int pagesize)
        {
            try
            {
                string hql = "from OrderDetail where State!=0 and DealInfoId="+DealInfoId ;

                return FindList<OrderDetail>(hql, null, (page - 1) * pagesize, pagesize);
            }
            catch
            {
                return null;
            }
        }
        #endregion

        #region 根据订单Id查询总数
        /// <summary>
        /// 根据订单Id查询总数
        /// </summary>
        /// <param name="DealInfoId"></param>
        /// <returns></returns>
        public int GetDealInfoId(int DealInfoId)
        {
            string hql = "select count(*) from OrderDetail where State!=0 and DealInfoId=" + DealInfoId;

            return Convert.ToInt32(GetValue(hql));
        }
        #endregion

        
    }
}
